<template>
	<!-- 选择审批人 -->
	<view>
		
		<u-toast ref="uToast"></u-toast><!-- 弹窗 -->
		<u-form ref="uForm">
			
			<!-- 检验员 -->
			<u-form-item label="检验员" prop="employeeName" label-width="180" class="form-item">
				<shzy-org-select v-model="employeeCode" :options="employeeNameList"
					@changeFun="employeeChange"></shzy-org-select>
			</u-form-item>
		
			<view class="buttom-actions">
				<u-button class="buttom-btn" @click="submit" type="primary">确定</u-button>
			</view>
		</u-form>
		
	</view>
	
	
</template>

<script>
	import {
		Transfer
	} from '@/api/q1/workFlow/Engine/engine.js'
	export default {
		data() {
			return {
				id:'',
				employeeCode:'',
				employeeNameList:[],
				data:{
					freeApproverUserId:''
				}
			}
		},
		onLoad(option){
			const json = JSON.parse(option.params);
			this.id = json.id;
		},
		methods: {
			// 获取检验员信息
			employeeChange(e, data) {
				//console.log(data)
				this.data.freeApproverUserId = data.id
			},
			submit(){
				console.log(this.id + "|" +this.employeeCode)
				console.log(this.data)
				Transfer(this.id,this.data).then(res =>{
					if(res.code == 200){
						this.$refs.uToast.show({
							title: "操作成功",
							type: 'success',
							duration: 1000,
							callback() {
								uni.navigateBack(); // 返回上一页
							}
						});
					}
				})
			}
		}	
		
	}
	
</script>

<style lang="scss">
	
	.form-item {
		margin: 10px 20px 10px 20px;
	}
</style>